<?
if (!defined ('L_MOD')) {die("<h3>You can`t access this file...</h3>");}

print "<h2>"._MYSITES_."</h2><br>";

$query=mysql_query("SELECT links . * , category.mod_id AS cat_id, 
	category.mod_category AS category_name, 
	category.mod_18 AS mod_18
	FROM ${wcpref}".$nma." links 
	INNER JOIN ${wcpref}".$nma."_category category ON links.mod_cat_id = category.mod_id 
	WHERE links.mod_user_id = '".$_SESSION['user_id']."'");

$d=0;
print '<table align="center" cellpadding="3" cellspacing="1" border="0" width="98%">';
while($result=mysql_fetch_array($query))
{
	$d++;$iclass = ($d % 2) ? "even" : "odd";
	extract($result);
	if ($mod_18==1)
		$add18='<font size="-3" color="#FF0000"><sup>18+</sup></font>';
	else
		$add18='';
	
	if ($mod_block==0)
		$lock_img='<img src="/images/'.$nma.'/lock_unlock.png" border="0" title="'._UNLOCKEDSITE_.'">';
	elseif($mod_block==1)
		$lock_img='<img src="/images/'.$nma.'/lock.png" border="0" title="'._LOCKEDSITE_.'">';
	
	if ($mod_map==1)
		$map_img='<img src="/images/'.$nma.'/chart_organisation.png" border="0" title="'._MAPALLOW_.'">';
	else
		$map_img='';
	
	if ($mod_wcps==1)
		$wcps_img='<img src="/images/'.$nma.'/wcps.gif" border="0" title="'._WCPSSITE_.'">';
	else
		$wcps_img='';
	
	if ($mod_ban==0)
		$ban_img='<img src="/images/'.$nma.'/accept.png" border="0" title="'._WCPSNOBAN_.'">';
	else
		$ban_img='<img src="/images/'.$nma.'/cross_octagon_fram.png" border="0" title="'._WCPSBAN_.'">';
	
	print '<tr class="'.$iclass.'">
		<td>
			<table align="center" cellspacing="1" cellpadding="1" border="0" width="100%">
				<tr>
					<td align="center"><a href="index.php?nma='.$nma.'&fla=category&cid='.$mod_cat_id.'">'.$category_name.'</a>'.$add18.'</td>
					<td><a href="http://'.$mod_url .'" target="_blank">'.$mod_name.'</a></td>
					<td>';
						if ($mod_wcps==0)
						{
							if ($mod_reverse_url!='')
								print'<a href="http://'.$mod_reverse_url.'" target="_blank" title="http://'.$mod_reverse_url.'">'._TYPERURL_.'</a>';
						}
					print'</td>
					<td align="center" width="19px">'.$wcps_img.'</td>
					<td align="center" width="19px">'.$lock_img.'</td>
					<td align="center" width="19px">'.$map_img.'</td>
					<td align="center" width="19px">'.$ban_img.'</td>
				</tr>
				<tr>
					<td colspan="7" align="center"><b>'._TYPESHORT_.'</b></td>
				</tr>
				<tr>
					<td colspan="7">'.$mod_short.'</td>
				</tr>';
				if ($mod_full!="")
				{
					print'<tr>
						<td colspan="7" align="center"><a href="#" onclick="choose(\'fulldesc'.$mod_id.'\')">'._TYPEFULL_.'</a></td>
					</tr>
					<tr>
						<td colspan="7">
							<div id="fulldesc'.$mod_id.'" style="display:none;">'.$mod_full.'
								<br><br>
							<a href="#" onclick="choose(\'fulldesc'.$mod_id.'\')">'._HIDEFULL_.'</a>
							</div>
						</td>
					</tr>';
				}
				if ($mod_wcps==0)
				{
					print'<tr>
						<td colspan="7" align="right">
							<a href="index.php?nma='.$nma.'&fla=edsite&sid='.$mod_id.'"><img src="/images/'.$nma.'/text_signature.png" border="0" title="'._EDIT_.'"></a>';
							print "<a href='index.php?nma=".$nma."&fla=dsite&sid=".$mod_id."' onClick=\"return confirm('"._DELETE_." &quot;".$mod_name."&quot;?');\">
								<img src='/images/".$nma."/cross.png' border='0' title='"._DELETE_."'>
							</a>";
						print '</td>
					</tr>';
				}
			print'</table>
		</td>
	</tr>';
}
print'</table>';
print '<br><table>
	<tr>
		<td align="left">
			<a href="?nma='.$nma.'&fla=index">'._TOCATEGORY_.'</a>&nbsp;&nbsp;
		</td>
	</tr>
</table>';
print '<br><br><table align="center" border="0" cellpadding="1" cellspacing="1">
	<tr>';
		if ($wccat_partnerid==0)
			$partnerId='';
		else
			$partnerId='&prom='.$wccat_partnerid;
		print'<td align="center">
			&nbsp;&nbsp;<a href="'.$wccat_service_url.'/index.php?nma=wccat&fla=addwcsite'.$partnerId.'">'._ADDWCPSSITE_.'</a>&nbsp;&nbsp;
		</td>
		<td align="center">';
			if ($wccat_allowadd==1)
				print'&nbsp;&nbsp;<a href="?nma='.$nma.'&fla=addsite">'._ADDOTHERSITE_.'</a>';
		print'</td>
	</tr>
</table>';

//print "<a href='index.php?nma=".$nma."&fla=edsite&sid=".$mod_id."' onClick=\"return confirm('"._DELETE_." &quot;".$result[0]."&quot;?');\"><img src=images/buttons/del.gif border=0></a>&nbsp;";
?>


<script language="JavaScript">
	function choose(id)
    {
		if (document.getElementById(id).style.display == 'none')
			show(id);
		else if(document.getElementById(id).style.display == 'block')
			hide(id);
	}

	function hide(id)
	{
		document.getElementById(id).style.display = 'none';
	}

	function show(id)
	{
		document.getElementById(id).style.display = 'block';
	}

</script>